package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.order.client.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 *
 * 订单跳转页
 * @author : zjj
 * @date : 2021/2/5 15:56
 */

@Controller
public class OrderController {

    /**
     * 远程调用订单服务
     */
    @Autowired
    private OrderFeignClient orderFeignClient;

    /**
     * 去结算按钮处理
     * @param model     model
     * @param request   request
     * @return          结果
     */
    @GetMapping("trade.html")
    public String trade(Model model, HttpServletRequest request){
        Result<Map<String, Object>> result = orderFeignClient.trade();
        model.addAllAttributes(result.getData());
        return "order/trade";
    }
}
